import request from '@/utils/request'
import { jsToFormData } from '@/api/jf/equipment'

export function add(data) {
  console.log('data', data)
  const formData = jsToFormData(data)
  console.log('formData', formData)
  return request({
    url: 'api/v2/base/farm/nannong/save',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime() }
  })
}

export function del(ids) {
  return request({
    url: 'api/v2/base/farm/nannong/del',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  console.log('data', data)
  const formData = jsToFormData(data)
  console.log('formData', formData)
  return request({
    url: 'api/v2/base/farm/nannong/save',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime() }
  })
}

export default { add, edit, del }
